<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Axios入门</title>
    <script src="js/axios-0.18.0.js"></script>
</head>
<body>

<script>
    // 使用axios发送AJAX的GET请求
/*    axios({
        method: "GET",
        url: "http://localhost:8080/ajax-demo/axiosServlet?username=zhangsan"
    }).then(function (resp) {
        // resp.data: 响应数据
        alert(resp.data);
    });*/

    // 使用axios发送AJAX的POST请求
    axios({
        method: "POST",
        url: "http://localhost:8080/ajax-demo/axiosServlet",
        data: "username=zhangsan"
    }).then(function (resp) {
        // resp.data: 响应数据
        alert(resp.data);
    });
</script>
</body>
</html>